###########################################
Replication Materials for "Government Formation in Presidentialism: disentangling the combined effects of pre-electoral coalitions and legislative polarisation"
###########################################

General Commentary:
In this folder, you'll find the materials to replicate the following study:
Couto, Lucas. "Government Formation in Presidentialism: disentangling the combined effects of pre-electoral coalitions and legislative polarisation," published in the Latin American Politics and Society.

You'll find the following files here:
- "repcode_1.R": R Script to make the tables and figures for the main document and the supplementary material.  

- "govfor_rr.csv": Updated dataset for government formation in Latin America.

You should note that I used other datasets throughout the script to run the analysis. However, as they are not my property, I feel uncomfortable sharing them. As a result, whenever I use a dataset that is a third-party's property, I note where you can find it. The same applies to the fonts I use in the data visualisations.

###########################################
Unfortunately, I don't provide the codebook to the dataset because I wasn't the responsible for the original version. As such, I don't have information on some variables. Nevertheless, I discuss some below:

-country_name_short: Short name of the countries under study.

-election_id: Individual identifier of the elections in the period under analysis.

-start_date: The day on which the cabinet was formed.

-cab_id: Individual identifier of each government formation opportunity in the dataset.

-alt_id: Alternative governments within each government formation opportunity.

-composition: Composition of each alternative government. This is only for updated cases. The information for the original version might be derived from the appendix of Freudenreich's doctoral thesis. He can be accessed at jfreudenreich@gmail.com.

-empgov: The alternative government that emerges from the government formation game is coded 1 and 0 otherwise.

-prevgov: The incumbent government is coded 1 and 0 otherwise. 

-numpar: The number of parties in each alternative government.

-seatscoal: The share of legislative seats in the lower or unique chamber of the legislature for each alternative government.

-minority: Coded 1 if seatscoal is lower or equal than 0.5 and 0 otherwise.

-uppermin: Coded 1 if the alternative government is in a minority situation in the upper chamber. This is only available for the original cases. 

-medianparty: Coded 1 if the alternative government contains the median party in its composition.

-extremeparties: Coded 1 if the alternative government contains extreme parties in its composition.

-ENPP: The effective number of parliamentary parties in each government formation opportunity.

-unicameral: Coded 1 if the legislature is unicameral and 0 if bicameral.

-division: The ideological division of each alternative government. It ranges from 0 to 4.

-pec: Coded 1 if the alternative government derives from a pre-electoral coalition, whether a complete mirror of it or an extension thereof. Coded 0 if not hails from a PEC or a pre-electoral coalition member is not in the composition.

-pecpar: Coded 1 if the alternative government is totally congruent to a pre-electoral coalition and 0 otherwise.

-pecext: Coded 1 if the alternative government is an extension of a pre-electoral coalition. That is, if the composition of the alternative government includes a partner that was absent from the original pre-electoral alliance. Coded 0 otherwise.

-majsit: Coded 1 if the presidential party attains a majority in the legislature by itself. 

-compcan: Alternative governments with a party that ran in the last presidential election as an opponent are coded 1 and 0 otherwise. Available only for the original cases. 

-secfin: Alternative governments that contain a party that came as second in the last presidential election in their composition are coded 1 and 0 otherwise. 

-presidential_election: Coded 1 if the government formation process is derived from the occurrence of a presidential election.

-parliamentary_election: Coded 1 if the government formation process is derived from the occurrence of a parliamentary election.

-year: Year of the government formation process.

-country_name_long: Long name of the countries under study.

-countrycode2: Identifier that combines country_name_long and year.

-division2: The ideological division of each alternative government, ranging from 0 to 10.

-polariz_st: Legislative Polarisation Index from Borges et al. (forthcoming).

-version: Coded 1 if it comes from the original dataset from Freudenreich and 2 if it was updated for this study.

-primary_election: Government formation processes for which there was a precedent primary election for the selection of the presidential runner are coded 1 and 0 otherwise.

-electoral_system: Family of the electoral system. 

-electoral_system_for_national_legislature: The electoral system for the legislature.

-polariz_st_BG: Legislative Polarisation Index with ideological positions from Baker and Greene (2011).

-elec_volat: Electoral Volatility based on the Pedersex Index (1983).

-presidential_party: The name of the presidential party.

-median_party: The name of the median party.

-ideo_pp: Policy position of the presidential party. It ranges from 0 to 20 and the data come from Borges et al. (forthcoming).

-ideo_mp: Policy position of the median party. It ranges from 0 to 20 and the data come from Borges et al. (forthcoming).

-diff_pp_mp: The ideological distance between presidential and median parties.

-prespow1: Presidential powers from Doyle and Elgie (2016).

###########################################
R sessionInfo()

R version 4.3.1 (2023-06-16 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 11 x64 (build 22631)

Matrix products: default


locale:
[1] LC_COLLATE=Portuguese_Brazil.utf8  LC_CTYPE=Portuguese_Brazil.utf8    LC_MONETARY=Portuguese_Brazil.utf8 LC_NUMERIC=C                       LC_TIME=Portuguese_Brazil.utf8    

time zone: America/Sao_Paulo
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] lubridate_1.9.2         forcats_1.0.0           stringr_1.5.0           dplyr_1.1.2             purrr_1.0.1             readr_2.1.4             tidyr_1.3.0            
 [8] tibble_3.2.1            tidyverse_2.0.0         survival_3.5-5          stargazer_5.2.3         sf_1.0-14               showtext_0.9-6          showtextdb_3.0         
[15] sysfonts_0.8.8          rnaturalearthdata_0.1.0 rnaturalearth_0.3.3     rmapshaper_0.5.0        readxl_1.4.3            ragg_1.2.5              patchwork_1.1.2        
[22] mclogit_0.9.6           Matrix_1.6-0            marginaleffects_0.13.0  haven_2.5.2             gridExtra_2.3           ggtext_0.1.2            ggplot2_3.5.0          

loaded via a namespace (and not attached):
 [1] tidyselect_1.2.0   TH.data_1.1-2      timechange_0.2.0   estimability_1.4.1 lifecycle_1.0.3    magrittr_2.0.3     compiler_4.3.1     rlang_1.1.1        tools_4.3.1       
[10] utf8_1.2.3         yaml_2.3.7         data.table_1.15.4  sp_2.0-0           classInt_0.4-9     curl_5.0.1         xml2_1.3.4         multcomp_1.4-25    abind_1.4-5       
[19] KernSmooth_2.23-21 withr_2.5.0        grid_4.3.1         fansi_1.0.4        xtable_1.8-4       e1071_1.7-13       colorspace_2.1-0   emmeans_1.8.8      scales_1.3.0      
[28] MASS_7.3-60        cli_3.6.1          mvtnorm_1.2-2      generics_0.1.3     rstudioapi_0.14    tzdb_0.4.0         httr_1.4.6         DBI_1.1.3          proxy_0.4-27      
[37] splines_4.3.1      cellranger_1.1.0   vctrs_0.6.3        V8_4.3.3           sandwich_3.0-2     jsonlite_1.8.5     carData_3.0-5      car_3.1-2          hms_1.1.3         
[46] systemfonts_1.0.4  units_0.8-2        glue_1.6.2         codetools_0.2-19   stringi_1.7.12     gtable_0.3.3       munsell_0.5.0      pillar_1.9.0       R6_2.5.1          
[55] memisc_0.99.31.6   textshaping_0.3.6  lattice_0.21-8     gridtext_0.1.5     class_7.3-22       Rcpp_1.0.10        coda_0.19-4        zoo_1.8-12         pkgconfig_2.0.3  

###########################################
For further inquiries, please do not hesitate to contact me at: lucasalmeidacouto040@gmail.com.